<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {:widget_st('layui','css')}
  {:widget_st('admin','css')}
  {:widget_st('bootstrap')}
  {:widget_st('jq','js')}
</head>
{:do_action('admin_head')}
<style>
  .zf_box{
    background-color: aliceblue;
    text-align: center;
    border: 1px solid #e6e6e6;
    height: 80px;
    line-height: 80px;
    font-weight: bold;
  }
</style>
<body>
  <div class="layui-fluid">
    <div class="">
      <div class="layui-row">
        <div class="layui-col-md6">
          <div class="layui-card ">
            <p>清除缓存</p>
            <table class="layui-table">
              <thead>
                <tr>
                  <th>操作</th>
                  <th>说明</th>
                </tr> 
              </thead>
              <tbody>
                <tr>
                  <td><span class="layui-btn layui-btn-xs zf_act" data-t="del_temp">删除缓存</span></td>
                  <td>删除/runtime/temp目录下所有文件</td>
                </tr>
                <tr>
                  <td><span class="layui-btn layui-btn-xs zf_act" data-t="del_log">删除日志</span></td>
                  <td>删除/runtime/log目录下所有文件</td>
                </tr>
                <tr>
                  <td><span class="layui-btn layui-btn-xs zf_act" data-t="del_backup">删除备份</span></td>
                  <td>删除/backup目录下所有文件</td>
                </tr>
                <tr>
                  <td><span class="layui-btn layui-btn-xs zf_act" data-t="del_upgrade">删除升级文件</span></td>
                  <td>删除/upgrade目录下所有文件</td>
                </tr>
                <tr>
                  <td><span class="layui-btn layui-btn-xs zf_act" data-t="del_theme_cache">删除模板缓存</span></td>
                  <td>删除模板缓存</td>
                </tr>
                <tr>
                  <td><span class="layui-btn layui-btn-xs zf_act" data-t="del_zfcms">清除系统授权</span></td>
                  <td>清除系统授权</td>
                </tr>
                <tr>
                  <td><span class="layui-btn layui-btn-xs zf_act" data-t="del_cache_aiauth">清除AI缓存</span></td>
                  <td>清除AI缓存</td>
                </tr>
              </tbody>
            </table>
            <p>功能下载</p>
            <table class="layui-table">
              <thead>
              <tr>
                <th>操作</th>
                <th>说明</th>
              </tr>
              </thead>
              <tbody>

                <?php foreach($addons_list as $k=>$v){ ?>
                <tr>
                  <td>
                    {$v['name']}<br>
                    <?php if(!is_dir($v['dir']) ){ ?>
                    <span class="layui-btn layui-btn-xs zf_act_addons" data-t="down_addons" data-addons_name="{$v['addons_name']}">下载到本地</span>
                    <?php }else{ ?>
                    <!--<span class="layui-btn layui-btn-xs zf_act_addons layui-bg-red" data-t="del_addons" data-addons_name="{$v['addons_name']}">删除本地文件</span>-->
                    <?php } ?>
                  </td>
                  <td>{$v['msg']}</td>
                </tr>
                <?php } ?>

              </tbody>
            </table>
          </div>
        </div>
        <div class="layui-col-md6">
          <div class="layui-card ">
            <p>下载样式</p>
            <table class="layui-table">
              <thead>
                <tr>
                  <th>操作</th>
                  <th>说明</th>
                </tr> 
              </thead>
              <tbody>
                <?php foreach($ys_list as $k=>$v){ ?>
                <tr>
                  <td>
                    {$v['name']}<br>
                    <?php if(!is_dir($v['dir']) ){ ?>
                      <span class="layui-btn layui-btn-xs zf_act_static" data-t="down_static" data-static_name="{$v['static_name']}">下载到本地</span>
                    <?php }else{ ?>
                      <span class="layui-btn layui-btn-xs zf_act_static layui-bg-red" data-t="del_static" data-static_name="{$v['static_name']}">删除本地文件</span>
                    <?php } ?>
                  </td>
                  <td>{$v['msg']}</td>
                </tr>
                <?php } ?>
                
              </tbody>
            </table>
          </div>
        </div>

      

    </div>
  </div>
  
  {:widget_st('layui','js')}  
  {:widget_st('common','js')} 

  <script>
 layui.use([ 'table'], function(){
    var $ = layui.$
    ,form = layui.form
    ,table = layui.table;
    
    $('.zf_act').click(function(){
      var t = $(this).data('t');
      var name = ''
      switch(t){
        case 'del_temp':
          name = '将删除/runtime/temp目录下所有文件,是否确认?';
          break;
        case 'del_log':
          name = '将删除/runtime/log目录下所有文件,是否确认?';
          break;
        case 'del_backup':
          name = '将删除/backup目录下所有文件,是否确认?';
          break;
        case 'del_upgrade':
          name = '将删除/upgrade目录下所有文件,是否确认?';
          break;
        case 'del_cache_aiauth':
          name = '清除AI授权缓存,是否确认?';
          break;
        default:
          name = '确定要执行此操作吗？'
      }
      var url = "?t="+t;
      layer.confirm(name, {
        btn: ['确定','取消'] //按钮
      }, function(){
        var index = layer.load(1);
        $.get(url,function(res){
          layer.close(index)
          if(res.result==1){
            layer.msg(res.msg,{icon:1});
          }else{
            layer.msg(res.msg,{icon:2});
          }
        },'json')
      }, function(){
        
      });
    })
    $('.zf_act_static').click(function(){
      var t = $(this).data('t');
      var static_name = $(this).data('static_name');
      if(t=='down_static'){
        var name = '确定要下载到本地吗?';
      }else{
        var name = '确定要删除本地文件吗?';
      }
      var url = "?t="+t+'&static_name='+static_name;
      layer.confirm(name, {
        btn: ['确定','取消'] //按钮
      }, function(){
        var index = layer.load(1);
        $.get(url,function(res){
          layer.close(index)
          if(res.result==1){
            layer.msg(res.msg,{icon:1});
            setTimeout(function(){
              window.location.reload();
            },1000)
          }else{
            layer.msg(res.msg,{icon:2});
          }
        },'json')
      }, function(){
        
      });
    })
   $('.zf_act_addons').click(function(){
     var t = $(this).data('t');
     var addons_name = $(this).data('addons_name');
     if(t=='down_addons'){
        var name = '确定要下载到本地吗?';
      }else{
        var name = '确定要删除本地文件吗?';
      }
     var url = "?t="+t+'&addons_name='+addons_name;
     layer.confirm(name, {
       btn: ['确定','取消'] //按钮
     }, function(){
       var index = layer.load(1);
       $.get(url,function(res){
         layer.close(index)
         if(res.result==1){
           layer.msg(res.msg,{icon:1});
           setTimeout(function(){
             window.location.reload();
           },1000)
         }else{
           layer.msg(res.msg,{icon:2});
         }
       },'json')
     }, function(){

     });
   })
    
   
   
  });
  </script>
</body>
</html>
{:do_action('admin_js')}
